package meiyunting.shiwuzhaoling.client;

import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 失物招领服务客户端降级实现
 * 当服务调用失败时提供降级处理
 */
@Component
public class LostFoundServiceClientFallback implements LostFoundServiceClient {
    
    @Override
    public Map<String, Object> getInstanceInfo() {
        Map<String, Object> fallback = new HashMap<>();
        fallback.put("port", "unknown");
        fallback.put("instanceId", "fallback");
        fallback.put("timestamp", System.currentTimeMillis());
        fallback.put("status", "fallback");
        return fallback;
    }
    
    @Override
    public List<Map<String, Object>> getUserLostItems(Long userId) {
        return new ArrayList<>();
    }
    
    @Override
    public List<Map<String, Object>> getUserFoundItems(Long userId) {
        return new ArrayList<>();
    }
    
    @Override
    public Map<String, Object> submitLostItem(Map<String, Object> itemData) {
        Map<String, Object> fallback = new HashMap<>();
        fallback.put("success", false);
        fallback.put("message", "服务暂时不可用，请稍后再试");
        return fallback;
    }
    
    @Override
    public Map<String, Object> submitFoundItem(Map<String, Object> itemData) {
        Map<String, Object> fallback = new HashMap<>();
        fallback.put("success", false);
        fallback.put("message", "服务暂时不可用，请稍后再试");
        return fallback;
    }
} 